Skip to content

Port Upstream Accuracy and Pricing Fixes - #113

Merged
mstallone merged 2 commits into
mainfrom
port-upstream-accuracy-fixes
Sep 5, 2026
Merged

Port Upstream Accuracy and Pricing Fixes#113
mstallone merged 2 commits into
mainfrom
port-upstream-accuracy-fixes

Conversation

@mstallone

Copy link
Copy Markdown
Owner

TL;DR

Selective re-implementation of the OpenUsage commits since Runway #111 that still apply: Claude Desktop's account-prefixed token caches, Claude spend tiles without an OAuth login, Grok subagent session ledgers, Codex Business Premium, Cursor's Models/Other Models labels, and new model rates.

What was happening

What this changes

  • Desktop cache selection strips the acct:<user>| prefix, keeps only the signed-in account (from lastKnownAccountUuid), and lets a scoped tombstone suppress the matching legacy V1 alias.
  • Unauthenticated Claude refreshes still scan local logs. Spend tiles render under the existing Not logged in notice when those logs contain usage; an empty machine stays a hard error card.
  • Grok scans every durable updates.jsonl ledger. Prompt-id dedup still drops forked parent replays. summary.json is no longer required to keep a ledger.
  • Codex maps self_serve_business_prolite to Business Premium.
  • Cursor widget IDs are unchanged. Titles/labels become Cursor Models / Other Models to match Cursor's dashboard.
  • Pricing supplement: GPT-6 Astra (OpenAI card, 2× fast), Gemini 3.8 Flash (Cursor table, $3.50 output), Fable 5.1, GLM 5.3, and grok-bot-* → Grok 4.6.

Heads-up

Reviewed and not ported, with reasons:

Gemini 3.8 Flash output is $3.50, from Cursor's table, not upstream's $3.75 Google API rate. That matches how Runway priced Gemini 3.7.

Tests

  • Desktop: prefixed key for the signed-in account wins; foreign acct: keys are ignored; a scoped V2 tombstone suppresses the V1 alias; load() reads lastKnownAccountUuid.
  • Claude: no credentials plus local logs → spend tiles and Not logged in, not an error card. Empty machine still errors.
  • Grok: subagent ledger is included; fork replay of a shared prompt still counts once.
  • Codex: self_serve_business_prolite → Business Premium, weekly-only window.
  • Pricing: Astra / 3.8 Flash / Fable 5.1 / GLM 5.3 / grok-bot slugs and router labels resolve. testEveryAliasCanonicalResolves covers the new rules.
  • Cursor mapper tests updated to the new labels; widget IDs unchanged.

swift test --filter "ClaudeDesktopAuthStoreTests|ClaudeProviderTests|CursorProviderTests|CursorUsageSummaryTests|GrokLogUsageScannerTests|CodexUsageMapperTests|PricingBundledResourceTests|LayoutStoreTests" — 179 tests, 1 skipped, 0 failures.

Re-implement the OpenUsage commits that fix real usage gaps without adding new metrics or fighting Runway's architecture: Desktop account-prefixed caches, Claude spend without OAuth, Grok subagent ledgers, Codex Business Premium, Cursor Models/Other Models labels, and new model rates.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

ClaudeDesktopAuthStore.selectCredential now passes Dictionary.filter(...) into a function expecting a Dictionary, which will not type-check without converting the filtered result back to [CacheKey: Any].

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Ports a targeted set of upstream accuracy/pricing fixes into Runway’s SwiftUI macOS app, improving provider log scanning and pricing resolution while keeping UI/widget identities stable.

Changes:

  • Updates Claude Desktop auth selection (account-prefixed token cache keys) and allows unauthenticated Claude refreshes to still surface local spend tiles when logs exist.
  • Expands Grok local session scanning to include subagent/resumed ledgers and updates Cursor/Codex labeling/mapping to match upstream naming and entitlements.
  • Extends pricing_supplement.json with new model rates/aliases and adds/updates regression tests and docs accordingly.
File summaries
File Description
Tests/RunwayTests/PricingBundledResourceTests.swift Adds assertions for new supplement-priced models and aliases.
Tests/RunwayTests/GrokLogUsageScannerTests.swift Updates expectations to include subagent session usage while deduplicating fork replays.
Tests/RunwayTests/CursorUsageSummaryTests.swift Renames expected Cursor usage line labels to “Cursor models” / “Other models”.
Tests/RunwayTests/CursorProviderTests.swift Updates Cursor mapper/provider tests for renamed labels while keeping IDs stable.
Tests/RunwayTests/CodexProviderTests.swift Adds regression coverage for Business Premium entitlement mapping.
Tests/RunwayTests/ClaudeProviderTests.swift Adds coverage for unauthenticated Claude refresh still showing local spend when logs exist.
Tests/RunwayTests/ClaudeDesktopAuthStoreTests.swift Adds coverage for account-prefixed Desktop token caches and tombstone behavior.
Sources/Runway/Resources/pricing_supplement.json Adds new model rates, fast multiplier, and alias rules (Gemini 3.8 Flash, GPT-6 Astra, Fable 5.1, GLM 5.3, grok-bot slugs).
Sources/Runway/Providers/Grok/GrokLogUsageScanner.swift Switches session discovery to include all updates.jsonl ledgers (including subagents/resumes).
Sources/Runway/Providers/Cursor/CursorUsageSummaryMapper.swift Renames Cursor plan usage labels to match Cursor dashboard terminology.
Sources/Runway/Providers/Cursor/CursorUsageMapper.swift Renames Cursor usage meter labels to “Cursor models” / “Other models”.
Sources/Runway/Providers/Cursor/CursorProvider.swift Renames Cursor metric titles/labels while preserving widget IDs.
Sources/Runway/Providers/Codex/CodexUsageMapper.swift Maps self_serve_business_prolite to “Business Premium”.
Sources/Runway/Providers/Claude/ClaudeProvider.swift Uses local log scan for unauthenticated installs; only shows hard error when there’s no local usage.
Sources/Runway/Providers/Claude/ClaudeDesktopAuthStore.swift Implements account-prefixed Desktop cache normalization and selection.
README.md Updates Cursor feature blurb to new metric naming.
docs/providers/grok.md Updates Grok spend-tile description to reflect inclusion of subagent/resumed sessions.
docs/providers/cursor.md Renames documented Cursor meters to “Cursor Models” / “Other Models”.
docs/providers/codex.md Documents Business Premium mapping for self_serve_business_prolite.
docs/providers/claude.md Documents account-prefixed Desktop tokens and unauthenticated local spend behavior.
docs/menu-bar.md Updates default-star naming for the renamed Cursor metrics.
Review details
  • Files reviewed: 21/21 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread Sources/Runway/Providers/Claude/ClaudeDesktopAuthStore.swift
@mstallone
mstallone merged commit d05f615 into main Sep 5, 2026
2 checks passed
@mstallone
mstallone deleted the port-upstream-accuracy-fixes branch September 5, 2026 01:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants